<template>
	<view>
		<page-head headTitle="商品添加" :returnButton="true" @clickLeftReturn="clickLeftReturn"></page-head>
		<form>
			<view class="bg-white m-t9">
				<view class="p-l-r3 flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">商品名称</text>
					<view><input type="text" placeholder-class="fs-3 placeholder" placeholder="请输入商品名称"></view>
				</view>
				<view class="p-l-r3 flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">商品介绍</text>
					<view><input type="text" placeholder-class="fs-3 placeholder" placeholder="请输入商品介绍"></view>
				</view>
				<view class="p-l-r3 flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</text>
					<view><input type="text" placeholder-class="fs-3 placeholder" placeholder="请输入商品价格"></view>
				</view>
				<view class="p-l-r3 flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">库&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</text>
					<view><input type="text" placeholder-class="fs-3 placeholder" placeholder="请输入商品库存"></view>
				</view>
				<view class="p-l-r3 flex height align-center border-botton">
					<text class="text fs-3 width-1 letter-s">状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态</text>
					<view>
						<radio-group class="flex" @change="radioChange">
							<label class="flex align-center m-r6" v-for="(item, index) in items" :key="item.value">
								<view>
									<radio :value="item.value" :checked="index === current" class="radio-button" color="#ffeb0f"/>
								</view>
								<view class="color-table">{{item.name}}</view>
							</label>
						</radio-group>
					</view>
				</view>
			</view>
			<upload-image :image="image"></upload-image>
			<bright-button title="确认"></bright-button>
		</form>
	</view>
</template>

<script>	
import pageHead from '@/components/common/page-head.vue'
import uploadImage from '@/components/common/upload-image.vue'
import brightButton from '@/components/common/bright-button.vue'
	export default {
		components:{
			pageHead,
			uploadImage,
			brightButton
			
		},
		data() {
			return {
				image:'/static/images/upload-product.png',
				items: [{
							value: '1',
							name: '上架'
						},
						{
							value: '2',
							name: '下架'
						}
					],
					current: 0
			}
		},
		methods: {
			clickLeft(){
				uni.navigateBack({
				    delta: 1
				});
			},
		   radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.target.value) {
						this.current = i;
						break;
					}
				}
			}
		}
	}
</script>

<style>

</style>
